#include "testsummator.h"
#include <QtTest/QtTest>

TestSummator::TestSummator(QObject * parent) :
        QObject(parent)
{
    m_summator = new Summator(this);
    m_summator->setA(3);
    m_summator->setB(15);
}

void TestSummator::test_setA()
{
    m_summator->setA(10);
    QCOMPARE(m_summator->sum(), 25);
}

void TestSummator::test_sum()
{
    QCOMPARE(m_summator->sum(), 25);
}

void TestSummator::test_valueChanged()
{
    QSignalSpy spy(m_summator, SIGNAL(valueChanged()));

    m_summator->setA(5);
    m_summator->setB(7);

    QCOMPARE(spy.count(), 2);
}
